﻿<%@ Page Title="Search Staff - Delonix Regia" Language="C#" MasterPageFile="~/default.Master" AutoEventWireup="true" CodeBehind="SearchStaff.aspx.cs" Inherits="DelonixRegia.SearchStaff" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphPageTitle" runat="server">
    Search Staff - Delonix Regia
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="cphTitle" runat="server">
    Search Staff
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphSubtitle" runat="server">
    Search for Staff in Delonix Regia
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="cphMain" runat="server">
    <asp:Panel ID="pnlFirstStep" runat="server">
        <div class="panel panel-default" id="firstStep" style="width: 800px; margin: 0 auto;">
        <div class="panel-heading">
            Search for Staff
        </div>

        <div class="panel-body">
            <div class="alert alert-danger" id="errorBox" style="display: none;">
            </div>
            <div class="alert alert-success" id="deleteSuccessBox" style="display: none;">
            </div>

            <table class="nav-justified">
                <tr>
                    <td class="text-right" colspan="7">
                        <table class="nav-justified" style="width: 500px; margin: 0 auto;">
                            <tr>
                                <td class="text-right" style="width: auto">Search by Staff ID:</td>
                                <td>&nbsp;</td>
                                <td>
                                    <asp:TextBox ID="tbxSearchStaffID" runat="server" CssClass="form-control" Width="80px" MaxLength="3"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="7" class="text-center">
                        <asp:Button ID="btnSearch" runat="server" Text="Search" CssClass="btn btn-default btn-lg" OnClientClick="return btnSearch_Click();" OnClick="btnSearch_Click" />
                    </td>
                </tr>
                </table>
        </div>
    </div>
    </asp:Panel>

    <asp:Panel ID="pnlSecondStep" runat="server" Visible="false">
        <div class="panel panel-default" id="secondStep" style="width: 800px; margin: 0 auto;">
        <div class="panel-heading">
            Staff Information
        </div>

        <div class="panel-body">

            <table class="nav-justified">
                <tr>
                    <td>
                        <table style="width:400px;margin:auto;" class="nav-justified">
                            <tr>
                                <td class="text-left" style="width: auto">First Name:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>
                                    <asp:Label ID="lblFirstName" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td class="text-left" style="width: auto">Last Name:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>
                                    <asp:Label ID="lblLastName" runat="server"></asp:Label>
                                </td>
                            </tr>
                             <tr>
                                <td class="text-left" style="width: auto">NRIC:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>
                                    <asp:Label ID="lblNRIC" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td class="text-left" style="width: auto">Date of Birth:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>  
                                    <asp:Label ID="lblDOB" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td class="text-left" style="width: auto">Bank Account No.:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>
                                    <asp:Label ID="lblBankNo" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td class="text-left" style="width: auto">Home Address:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>
                                    <asp:Label ID="lblHomeAddress" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td class="text-left" style="width: auto">Phone No.:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>
                                    <asp:Label ID="lblPhoneNo" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td class="text-left" style="width: auto">Email Address:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>
                                    <asp:Label ID="lblEmail" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td class="text-left" style="width: auto">Duty Type:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>
                                    <asp:Label ID="lblDutyType" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td class="text-center" colspan="6" style="height: 22px">
                        <asp:Button ID="btnEdit" runat="server" Text="Edit Staff" CssClass="btn btn-default btn-lg" OnClick="btnEdit_Click" />
                    </td>
                </tr>
                <tr>
                    <td class="text-center" colspan="6" style="height: 22px">&nbsp;</td>
                </tr>
                <tr>
                    <td class="text-center" colspan="6" style="height: 22px">
                        <asp:Button ID="btnGoBackPanel2" runat="server" Text="< Go back" CssClass="btn btn-default btn-lg" OnClick="btnGoBackPanel2_Click"/>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    </asp:Panel>

    <asp:Panel ID="pnlThirdStep" runat="server" Visible="false">
        <div class="panel panel-default" id="thirdStep" style="width: 800px; margin: 0 auto;">
        <div class="panel-heading">
            Staff Information
        </div>

        <div class="panel-body">
            <div class="alert alert-danger" id="searchErrorBox" style="display: none;">
            </div>
            <div class="alert alert-danger" id="deleteErrorBox" style="display: none;">
            </div>
            <div class="alert alert-success" id="successBox" style="display: none;">
            </div>

            <table class="nav-justified">
                <tr>
                    <td>
                        <table style="width:350px;margin:auto;" class="nav-justified">
                            <tr>
                                <td class="text-left" style="width: auto">First Name:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>
                                    <asp:TextBox ID="tbxFirstName" runat="server" CssClass="form-control" Width="187px" MaxLength="15"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="text-left" style="width: auto">Last Name:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>
                                    <asp:TextBox ID="tbxLastName" runat="server" CssClass="form-control" Width="187px" MaxLength="15"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="text-left" style="width: auto">NRIC:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>
                                    <asp:TextBox ID="tbxNRIC" runat="server" CssClass="form-control" Width="187px" MaxLength="9"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="text-left" style="width: auto">Date of Birth:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>  
                                    <asp:TextBox ID="tbxDOB" runat="server" CssClass="form-control" Width="187px"></asp:TextBox>  
                                    <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajaxToolkit:ToolkitScriptManager>
                                    <ajaxToolkit:CalendarExtender ID="CalendarExtender1" TargetControlID="tbxDOB" runat="server" Format="dd-MM-yyyy"></ajaxToolkit:CalendarExtender>
                                </td>
                            </tr>
                            <tr>
                                <td class="text-left" style="width: auto">Bank Account No.:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>
                                    <asp:TextBox ID="tbxBankNo" runat="server" CssClass="form-control" Width="187px" MaxLength="10"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="text-left" style="width: auto">Home Address:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>
                                    <asp:TextBox ID="tbxAddress" runat="server" CssClass="form-control" Width="187px" MaxLength="30"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="text-left" style="width: auto">Phone No.:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>
                                    <asp:TextBox ID="tbxPhoneNo" runat="server" CssClass="form-control" Width="187px" MaxLength="8"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="text-left" style="width: auto">Email Address:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>
                                    <asp:TextBox ID="tbxEmail" runat="server" CssClass="form-control" Width="187px" MaxLength="30"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="text-left" style="width: auto">Duty Type:</td>
                                <td style="width: 15px">&nbsp;</td>
                                <td>
                                     <asp:DropDownList ID="ddlDutyType" runat="server" CssClass="form-control" Width="187px">
                                         <asp:ListItem Selected="True" Value="1">General Maintenance</asp:ListItem>
                                         <asp:ListItem Value="2">Room Maintenance</asp:ListItem>
                                         <asp:ListItem Value="3">Estate Maintenance</asp:ListItem>
                                         <asp:ListItem Value="4">Security Maintenance</asp:ListItem>
                                     </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td class="text-center" colspan="6" style="height: 22px">
                        <asp:Button ID="btnSave" runat="server" Text="Save Changes" CssClass="btn btn-default btn-lg" OnClick="btnSave_Click" />
                        <ajaxToolkit:ConfirmButtonExtender ID="btnSave_ConfirmButtonExtender" runat="server" ConfirmText="Are you sure you want to update the staff information?" Enabled="True" TargetControlID="btnSave"></ajaxToolkit:ConfirmButtonExtender>
                        <asp:Button ID="btnDelete" runat="server" Text="Delete Staff" CssClass="btn btn-default btn-lg" OnClick="btnDelete_Click" />
                        <ajaxToolkit:ConfirmButtonExtender ID="btnDelete_ConfirmButtonExtender" runat="server" ConfirmText="Are you sure you want to delete the staff?" Enabled="True" TargetControlID="btnDelete"></ajaxToolkit:ConfirmButtonExtender>
                    </td>
                </tr>
                <tr>
                    <td class="text-center" colspan="6" style="height: 22px">&nbsp;</td>
                </tr>
                <tr>
                    <td class="text-center" colspan="6" style="height: 22px">
                        <asp:Button ID="btnGoBackPanel3" runat="server" Text="< Go back" CssClass="btn btn-default btn-lg" OnClick="btnGoBackPanel3_Click"/>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    </asp:Panel>

    <script type="text/javascript">

        $('#cphMain_tbxFirstName').keydown(errorBoxHide);
        $('#cphMain_tbxLastName').keydown(errorBoxHide);
        $('#cphMain_tbxNRIC').keydown(errorBoxHide);
        $('#cphMain_tbxDOB').keydown(errorBoxHide);
        $('#cphMain_tbxBankNo').keydown(errorBoxHide);
        $('#cphMain_tbxAddress').keydown(errorBoxHide);
        $('#cphMain_tbxPhoneNo').keydown(errorBoxHide);
        $('#cphMain_tbxEmail').keydown(errorBoxHide);
        $('#cphMain_ddlDutyType').change(errorBoxHide);
        $('#cphMain_tbxSearchStaffID').keydown(errorBoxHide);
        
        function errorBoxHide() {
            $('#errorBox').hide();
            $('#successBox').hide();
            $('#searchErrorBox').hide();
            $('#deleteErrorBox').hide();
            $('#deleteSuccessBox').hide();
        }

        function btnSearch_Click() {
            var StaffID = $('#cphMain_tbxSearchStaffID').val();

            if (is_int(StaffID) != true) {
                $('#errorBox').html('<strong>Error:</strong> Invalid datatype! You need to enter a number!');
                $('#errorBox').hide().show();
                return false;
            }
        }

        function is_int(value) {
            for (i = 0 ; i < value.length ; i++) {
                if ((value.charAt(i) < '0') || (value.charAt(i) > '9')) return false;
            }
            return true;
        }

        function transitionToFirstStep() {
            $('#firstStep').hide().show('slide', { direction: 'left', easing: 'easeOutQuart', duration: 600 });
        }

        function transitionToSecondStep() {
            $('#secondStep').hide().show('slide', { direction: 'right', easing: 'easeOutQuart', duration: 600 });
        }

        function transitionToThirdStep() {
            $('#thirdStep').hide().show('slide', { direction: 'right', easing: 'easeOutQuart', duration: 600 });
        }
    </script>
</asp:Content>
